package com.qing.letter;

import java.util.function.Function;

public class Demo {

	public static void main(String[] args) {
		Function<String,String> addHeader=Letter::addHeader;
		//信需要开头，检查，结尾
		Function<String,String> transformationPipeline=addHeader.andThen(Letter::checkSpelling).andThen(Letter::addFooter);
		String letter=transformationPipeline.apply("Hello AAA");
		System.out.println(letter); //信的结尾：信的开头：Hello aaa
		//现在不需要检查了
		Function<String,String> transformation=addHeader.andThen(Letter::addFooter);
		String letter2=transformation.apply("Hello AAA"); //信的结尾：信的开头：Hello AAA
		System.out.println(letter2);
	}
}
